package com.gp.shaw.netty.nio.im.model;

import lombok.Getter;
import lombok.Setter;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.nio.channels.SocketChannel;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

/**
 * Created by asus on 2018/11/1.
 */
@Getter
@Setter
public class IMUser {
    //用户唯一标识
    private String id;
    //socket
    private SocketChannel channel;
    //所属小组
    private Set<String> groups = new HashSet<>();

    public void addGroup(String groupId){
        groups.add(groupId);
    }

    public boolean inThisGroup(String groupId){
        if(groups==null||groups.size()<=0){
            return false;
        }
        return groups.contains(groupId);
    }

}
